#!/bin/bash
confirmed="n"

gitTagAdd() {
git stash
git pull origin master --tags
git stash pop

VersionString=`grep -E 's.version.*=' YYYNetworking.podspec`
VersionString=${VersionString##*=}
VersionNumber=`tr -d "'" <<<"$VersionString"`
echo "current version is ${VersionNumber}"

git add .
git commit -am ${VersionNumber}
git tag ${VersionNumber}
git push origin master --tags
}
echo -e "================================================\n"
echo -e "tag version 是否需要上传"
echo -e "================================================\n"

read -p "confirm? (y/n):" confirmed
if [ "$confirmed" == "y" -o "$confirmed" == "Y" ]; then
gitTagAdd
fi

cd ~/.cocoapods/repos/YYYPrivatePods && git pull origin master && cd - &&
pod repo push YYYPrivatePods YYYNetworking.podspec --allow-warnings --use-libraries

